package runesim.testing;
import java.io.*;
public class WeightInserter {

	public static void main(String[] args){
		try {
			MySQL.connect("root", "", "localhost", 3306, "test");
			BufferedReader in = new BufferedReader(new FileReader("output.txt"));
			String line = null;
			
			while((line = in.readLine()) != null){
				if(line.length() == 0) continue;
				
				String[] splittedStr = line.split("\t\t");
				int id = Integer.parseInt(splittedStr[0]);
				double weight = Double.parseDouble(splittedStr[1]);
				
				MySQL.update("INSERT INTO `[n]weights` (itemid, weight) VALUES ('"+id+"', '"+weight+"')");
			}
			
			System.out.println("done");
		} catch(Exception e){
			System.out.println("Parse error: "+e);
			e.printStackTrace();
		}
	}
}